package bean;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import javax.naming.InitialContext;
import javax.sql.DataSource;
import javax.naming.*;

public class MyOraclePool {

	Connection conn = null;
	
	public MyOraclePool() {
		try
		{
			Context context = new InitialContext();
			DataSource ds = (DataSource)((InitialContext) context).lookup("java:comp/env/jdbc/OracleDB");
			conn = ds.getConnection();
		}
		catch(Exception e)
		{
			
		}
	}

	
	public ArrayList<MemberVo> select()
	{
		ArrayList<MemberVo> al = new ArrayList<MemberVo>();
		String sql = "select * from member";
		
		try
		{
			PreparedStatement ps = conn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next())
			{
				MemberVo vo = new MemberVo();
				vo.setMid("mid");
				vo.setIrum("irum");
				al.add(vo);
			
			}
		}
		catch(Exception e)
		{
			
		}
		return al;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
